qui {
global controls "lngdp gdp_capita i.year"
glm level_share burqual_ic_norm $controls , nolog link(logit) family(binomial) robust cluster(iso3n)
gen sample = e(sample) 

reg burqual_ic_norm $controls if sample == 1
predict res_burqual_ic_norm, res
reg level_share $controls if sample == 1
predict res_level_share, res
reg peak_share $controls if sample == 1
predict res_peak_share, res
reg cut_share $controls if sample == 1
predict res_cut_share, res
}

graph drop _all 

* GABON 
capture graph drop g1
spearman res_burqual_ic_norm res_level_share if reporter == 266
local rho: display %3.2f r(rho)
local p: display %3.2f r(p) 
twoway line res_level_share year if reporter == 266 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_level_share year if reporter == 266 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 266, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 266, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   legend(off) l1title("Gabon", box bexpand ring(1)) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel) ///
   text( .18 2012 "{&rho} = `rho'" )  text(.162 2012 "(`p')" ) ///
   xlabel(, nolabel noticks) ///
   t1title("Uniform tariff", box bexpand ring(1)) name(g1) ///
   plotregion(margin(l+2 r+2))   xscale(off) yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero)) fysize(110) fxsize(108) nodraw
spearman res_burqual_ic_norm res_level_share if reporter == 266

capture graph drop g2
spearman res_burqual_ic_norm res_peak_share if reporter == 266
local rho: display %3.2f r(rho)
local p: display %3.2f r(p) 
twoway line res_peak_share year if reporter == 266 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_peak_share year if reporter == 266 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 266, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 266, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   xlabel(, nolabel noticks) ///
   legend(off) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel) ///
   text( -.121 2010 "{&rho} = `rho'" )  text( -.128 2010 "(`p')" )  ///
   t1title("Tariff peaks", box bexpand ring(1)) name(g2) ///
   plotregion(margin(l+2 r+2))   xscale(off)  yscale(off axis(1)) yscale(off axis(2))  graphregion(margin(zero)) fysize(110) fxsize(100) nodraw
spearman res_burqual_ic_norm res_peak_share if reporter == 266

capture graph drop g3
spearman res_burqual_ic_norm res_cut_share if reporter == 266
local rho: display %3.2f r(rho)
local p: display %3.2f r(p) 
twoway line res_cut_share year if reporter == 266 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_cut_share year if reporter == 266 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 266, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 266, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   xlabel(, nolabel noticks) ///
   legend(off) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel) ///
   text( -.082 2010 "{&rho} = `rho'" )  text(-.09 2010 "(`p')" ) ///
   t1title("Selective cuts", box bexpand ring(1)) name(g3) ///
   plotregion(margin(l+2 r+2))   xscale(off)  yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero))  fysize(110) fxsize(100) nodraw
spearman res_burqual_ic_norm res_cut_share if reporter == 266


* PHILIPPINES 
capture graph drop p1
spearman res_burqual_ic_norm res_level_share if reporter == 608
local rho: display %3.2f r(rho)
local p: display %3.2f r(p)
twoway line res_level_share year if reporter == 608 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_level_share year if reporter == 608 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 608, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 608, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   xlabel(, nolabel noticks) ///
   legend(off) l1title("Philippines", box bexpand ring(1)) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel) ///
   plotregion(margin(l+2 r+2))   text( 0.08 2010 "{&rho} = `rho'" )  text( .02 2010 "(`p')" ) name(p1) ///
   xscale(off)  yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero)) fysize(100) fxsize(108) nodraw

capture graph drop p2
spearman res_burqual_ic_norm res_peak_share if reporter == 608
local rho: display %3.2f r(rho)
local p: display %3.2f r(p)  
twoway line res_peak_share year if reporter == 608 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_peak_share year if reporter == 608 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 608, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 608, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   xlabel(, nolabel noticks) ///
   legend(off) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel) ///
   text( 0.16 2010 "{&rho} = `rho'" )  text( .13 2010 "(`p')" ) name(p2) ///
   plotregion(margin(l+2 r+2)) xscale(off)  yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero)) fysize(100) fxsize(100) nodraw
spearman res_burqual_ic_norm res_peak_share if reporter == 608

capture graph drop p3
spearman res_burqual_ic_norm res_cut_share if reporter == 608
local rho: display %3.2f r(rho)
local p: display %3.2f r(p)  
twoway line res_cut_share year if reporter == 608 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_cut_share year if reporter == 608 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 608, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 608, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   xlabel(, nolabel noticks) ///
   legend(off) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel) ///
   text( 0.05 1993 "{&rho} = `rho'" )  text( .035 1993 "(`p')" ) name(p3) ///
   plotregion(margin(l+2 r+2))  xscale(off)  yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero)) fysize(100) fxsize(100) nodraw
spearman res_burqual_ic_norm res_cut_share if reporter == 608


* BOLIVIA
capture graph drop b1
spearman res_burqual_ic_norm res_level_share if reporter == 68
local rho: display %3.2f r(rho)
local p: display %3.2f r(p) 
twoway line res_level_share year if reporter == 68 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_level_share year if reporter == 68 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 68, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 68, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   legend(off) l1title("Bolivia", box bexpand ring(1)) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, nolabel noticks axis(2)) ylabel(, noticks nolabel) ///
   text(-.05 2012 "{&rho} = `rho'" )  text(-.125 2012 "(`p')" ) name(b1) ///
   plotregion(margin(l+2 r+2))  yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero)) fysize(115) fxsize(108)  nodraw
spearman res_burqual_ic_norm res_level_share if reporter == 68

capture graph drop b2
spearman res_burqual_ic_norm res_peak_share if reporter == 68
local rho: display %3.2f r(rho)
local p: display %3.2f r(p) 
twoway line res_peak_share year if reporter == 68 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_peak_share year if reporter == 68 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 68, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 68, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   legend(off) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel ) ///
   text(.1 2012 "{&rho} = `rho'" )  text(.05 2012 "(`p')" ) name(b2) ///
   plotregion(margin(l+2 r+2))  yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero)) fysize(115) fxsize(100)  nodraw
spearman res_burqual_ic_norm res_peak_share if reporter == 68

capture graph drop b3
spearman res_burqual_ic_norm res_cut_share if reporter == 68
local rho: display %3.2f r(rho)
local p: display %3.2f r(p) 
twoway line res_cut_share year if reporter == 68 , yaxis(1) lcolor(gs10) lwidth(thick) ///
   || scatter res_cut_share year if reporter == 68 , yaxis(1) msymbol(circle) lcolor(gs12) fcolor(gs12) ///
   || line res_burqual_ic_norm  year if reporter == 68, yaxis(2) lcolor(gs8) lwidth(thick) lpattern(dash) ///
   || scatter res_burqual_ic_norm  year if reporter == 68, yaxis(2) msymbol(circle) lcolor(gs8) fcolor(gs8) ///
   legend(off) xtitle("") ytitle("", axis(2)) ytitle("") ylabel(, noticks nolabel axis(2)) ylabel(, noticks nolabel) ///
   text(.02 2012 "{&rho} = `rho'" )  text(-.01 2012 "(`p')" ) name(b3) ///
   plotregion(margin(l+2 r+2)) yscale(off axis(1)) yscale(off axis(2)) graphregion(margin(zero)) fysize(115) fxsize(100) nodraw
spearman res_burqual_ic_norm res_cut_share if reporter == 68

graph combine g1 g2 g3 p1 p2 p3 b1 b2 b3 , cols(3) rows(3) xsize(6) ysize(5.2)

graph export "Figure2.eps", as(eps) replace
graph export "Figure2.pdf", as(pdf) replace
